<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@ include file="/Pages/Jsp/Common/header.jsp"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<script language="javascript" type="text/javascript"
			src="<%=request.getContextPath()%>/Pages/Js/visitForum.js"></script>
		<link type="text/css"
			href="<%=request.getContextPath()%>/Pages/Css/main.css"
			rel="stylesheet" />
		<link type="text/css"
			href="<%=request.getContextPath()%>/Pages/Css/forum/forumIndex.css"
			rel="stylesheet" />

		<script type="text/javascript">

</script>
		<title>EKMS::Forum</title>
	</head>
	<body>
		<div id="outBox">
			<div id="mainContent">
				<div id="header_browse">
					<div class="title2">
						All Forums
					</div>

					<div class="links test_buttons">
						<a title="Create A New Forum"
							href="<%=request.getContextPath()%>/forum/createForum.do?action=load"
							id="create_forum_link"><span class="left"><span
								class="create_forum">Create Forum</span> </span> </a>
						<a title="Maintain Existing Forum"
							href="<%=request.getContextPath()%>/forum/modifyForum.do?action=listForum"
							id="maintain_forum_link"><span class="left"><span
								class="maintain_forum">Maintain Forum</span> </span> </a>
						<span class="search_forum"> <input id="forumNameQuery"
								name="forumNameQuery" type="text" maxlength="20"
								value="${forumNameQuery}"> <input
								id="hiddenForumNameQuery" style="display: none" type="text"
								value="${forumActiveQuery}"> <input type="button"
								value="Search" onClick="searchForum()" /> </span>
					</div>
					<div class="clear"></div>
				</div>

				<div id="forum_list">
					<form name="frmListForum" method="post">
						<table class="forum_list">
							<tr>
								<th>
									<a onClick="sortForum(this)" title="name" class="">Forum </a>
								</th>
								<th class="th2">
									<a onClick="sortForum(this)" title="topics">Topics</a>

								</th>
								<th class="th2">
									<a onClick="sortForum(this)" title="posts">Posts</a>

								</th>
								<th>
									<a onClick="sortForum(this)" title="lastPost">Last Post</a>
								</th>
							</tr>
							<logic:iterate id="forumInfo" name="forumInfoList"
								type="com.capgemini.fs.app.ekms.service.util.data.ForumInfo">
								<tr>
									<td class="forum">
										<div>
											<input style="display: none" id="Id" title="forumId"
												value="${forumInfo.id}" />
											<input style="display: none" id="ForumName"
												value="${forumInfo.forumName}" />
										</div>
										<div>
											<span id="ForumName" class="subject"> <a
												class="subject" name="${forumInfo.id}"
												onclick="showDetail(this)"> ${forumInfo.forumName}</a> </span><span
												class="today_topics">(today:${forumInfo.newTopicCountsToday})</span>
										</div>
										<div>
											<input style="display: none" id="ForumDesc"
												value="${forumInfo.description}" />
											<span id="ForumDesc" class="description"><bean:write
													name="forumInfo" property="description" /> </span>
										</div>
										<div>
											<span class="description2">Moderators:</span>
											<logic:iterate id="moderator" name="forumInfo"
												property="moderators">
												<span class="user_name">${moderator.userName}</span>
											</logic:iterate>
										</div>
									</td>
									<td class="number">
										${forumInfo.topicCounts}
									</td>
									<td class="number">
										${forumInfo.postCounts}
									</td>
									<td>
										<logic:notEmpty name="forumInfo" property="lastTopic">
											<div>
												<a href="#" name="${forumInfo.lastTopic.id}"
													class="topic_link" onclick="showTopicDetail(this)">${forumInfo.lastTopic.subject}</a>
											</div>
											<div class="user_name">
												<span class="description">by:</span>
												${forumInfo.lastTopic.author.userName}
											</div>
											<div class="description">
												${forumInfo.lastTopic.author.createDate}
											</div>
										</logic:notEmpty>
										<logic:empty name="forumInfo" property="lastTopic">
											<span class="description">No topics</span>
										</logic:empty>
									</td>
								</tr>
							</logic:iterate>
						</table>
						<div id="pageLinks">
							<a href="#" onClick="goToFirstPage()"> First Page </a>
							&nbsp;&nbsp;
							<a href="#" onClick="goToPreviousPage()"> Previous Page </a>
							&nbsp;&nbsp;
							<input readonly="readonly" class="span-2" id="currentPage"
								value="${totalPage}" />
							&nbsp;&nbsp;
							<a href="#" onclick="goToNextPage()"> Next Page </a> &nbsp;&nbsp;
							<a href="#" onClick="goToLastPage()"> Last Page </a> &nbsp;&nbsp;
							<input class="span-1" name="targetPage" id="pageNum" />
							<input style="display: none" name="nowPage" value="${nowPage}"></input>
							<input style="display: none" name="totalPage"
								value="${totalPageNum}"></input>
							<input type="button" value="Go" onClick="goToPage()" />
						</div>
						<input style="display: none" id="hiddenForumID" name="forumId">

						<input id="sortType" name="sortType" style="display: none"
							value="${sortType}"></input>
						<input id="sortOrder" name="sortOrder" style="display: none"
							value="${sortOrder}"></input>
						<div class="clear"></div>
					</form>
				</div>
			</div>
		</div>
	</body>
</html>